﻿@using PInitiatives.Helpers
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>@ViewBag.Title</title>
    <meta name="viewport" content="width-device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/bootstrap.css")"  rel="stylesheet" type="text/css">
    <link href= "@Url.Content("~/Content/inicjatywy.css")"  rel="stylesheet" type="text/css">
    <link href= "@Url.Content("~/Content/filtering.css")"  rel="stylesheet" type="text/css">
    <link href= "@Url.Content("~/Content/jquery.ui.accordion.css")"  rel="stylesheet" type="text/css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/bootstrap.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/inicjatywy.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>


        <script src="../../Scripts/jquery.cookie.js" type="text/javascript"></script>
        <script src="../../Scripts/jquery.hotkeys.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.jstree.js" type="text/javascript"></script>

   

</head>


<body onload="onLoad()">
    <!-- pasek nawigacji-->
    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner ini-green">
            <div class="container">
                <div class="row">
                    <div class="span1">
                        <!-- logo -->
                        <a href="@Url.Action("Index", "Home")" class="ini-logo pull-left">
                            <img style="max-width: 120%;" src="@Url.Content("~/Content/img/logo12.png")"/></a>
                    </div>
                    <div class="span4">
                        <!-- wyszukiwarka -->
                        <form class="navbar-form pull-left" action="../Initiative/Browse">
                        <input type="text" class="span3" name="searchString" placeholder="Szukaj">
                        </form>
                    </div>
                    <!-- 2 przyciski dropdown + logout button -->
                    
                    @if (Request.IsAuthenticated)
                    {//widoczne tylko gdy jest się zalogowanym

                    <div class="span4">
                        <div class="btn-toolbar ini-btn-toolbar">
                            <!-- przycisk inicjatyw -->
                            <div class="btn-group">
                                
                                <a class="btn dropdown-toggle btn-success" data-toggle="dropdown" href="#"><i class="icon-ok icon-white"></i> Iventy <span class="caret">
                                </span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="@Url.Action("Create", "Initiative")"><i class="icon-plus-sign"></i> Utwórz Nowy</a></li>
                                    <li><a href="@Url.Action("Browse", "Initiative", new { created = 1 })"><i class="icon-star-empty"></i> Utworzone przez Ciebie</a></li>
                                    <li><a href="@Url.Action("Browse", "Initiative", new { participated = 1, status = "Active" })"><i class="icon-calendar"></i> W których bierzesz udział</a></li>
                                    <li><a href="@Url.Action("Browse", "Initiative", new { participated = 1, status = "Finished" })"><i class="icon-check"></i> W których brałeś udział</a></li>
                                    <li><a href="@Url.Action("Browse", "Initiative")"><i class="icon-eye-open"></i> Przejrzyj wszystkie</a></li>
                                </ul>
      

                            </div>
        
                            <!-- przycisk profilu -->
                            <div class="btn-group">
                                <a class="btn dropdown-toggle btn-success" data-toggle="dropdown" href="#"><i class="icon-home icon-white"></i> Profil <span class="caret">
                                </span></a>
                                <ul class="dropdown-menu">
                                    @*<li><a href="/Account/Profile/36"><i class="icon-user"></i> User36</a></li>*@
                                    @if (User.Identity.IsAuthenticated)
                                    {
                                        <li><a href="@Url.Action("Profile", "Account", new { id = UserHelper.GetCurrentUserId() })"><i class="icon-user"></i> Mój profil</a></li>
                                    }
                                    else
                                    { 
                                        <li><a href="@Url.Action("LogOn", "Account")"><i class="icon-user"></i> Mój profil</a></li>
                                    }
                                    @*<li><a href="@Url.Action("AccountEdit", "Account")"><i class="icon-cog"></i> Ustawienia Konta</a></li>*@
                                    <li><a href="@Url.Action("ToReview", "Review")"><i class="icon-edit"></i> Do oceny</a></li>
                                    <li><a href="@Url.Action("LogOff", "Account")"><i class="icon-off"></i> Wyloguj</a></li>
                                        <!--
                                    <li><a href="#"><i class="icon-flag"></i> Pomoc</a></li>
                                    <li class="divider"></li>
                                    <li><a href="#"><i class="icon-off"></i> Wyloguj</a></li>
                                    -->
                                </ul>
                            </div>
                        </div>
                    </div>
                    
                    <div class="span3  ini-logout-btn">
                        <!-- logout button -->
                        <div class="ini-white-link">
                            @Html.Partial("_LogOnPartial")</div>
                    </div>
                        
                    }
                    else
                    {
                        <div class="span4">
                           <div class="btn-toolbar ini-btn-toolbar">
                            <!-- przycisk inicjatyw -->
                            <div class="btn-group">
                                
                                <a class="btn dropdown-toggle btn-success" data-toggle="dropdown" href="#"><i class="icon-ok icon-white"></i> Iventy <span class="caret">
                                </span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="@Url.Action("Browse", "Initiative")"><i class="icon-eye-open"></i> Przejrzyj wszystkie</a></li>
                                </ul>
      

                            </div>
                        </div>
                         </div>
                        
                        
                        <div class="span3 ini-logout-btn">
                        <!-- logout button -->
                        <div class="ini-white-link">
                            @Html.Partial("_LogOnPartial")</div>
                    </div>
                        //Koniec (if (Request.IsAuthenticated))
                    }

                    
                        
                </div>
            </div>
        </div>
    </div>
    <!-- end pasek nawigacji -->
    <div class="container">
        <!-- odstęp pionowo 2x -->
        <div class="row-fluid">
            <div class="span12">
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
            </div>
        </div>
        <!-- end odstęp -->
        <div class="row-fluid">
            <!-- menu boczne drzewa kategorii inicjatyw-->
            <div class="span3">
                <div class="row-fluid ini-side-menu-label">
                    <div class="span1  ini-side-menu-label-inner">
                        &nbsp 
                    </div>
                    <div class="span9  ini-side-menu-label-inner">
                        <h3>Kategorie</h3>
                    </div>
                    
                    @if (!string.IsNullOrEmpty(Request.QueryString["category"]))
                    {
                        <div class="span2  ">
                        <a href="@Url.Action("Index", "Home", new { id =  5})" class="ini-logo pull-left">
                            <img alt="kategoria wyżej" src="@Url.Content("~/Content/img/arrow-up.gif")"/></a>
                        </div>
                    }
                    

                </div>
                <div class="row-fluid">
                    <div class="well ini-side-menu-tree">


                 
                 <!--
                 <ul class="jstree-no-dots jstree-no-icons"><li id="/Initiative/Browse?category=1" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a class="jstree-clicked"><ins class="jstree-icon">&nbsp;</ins>Gry</a><ul style=""><li id="/Initiative/Browse?category=8" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a class=""><ins class="jstree-icon">&nbsp;</ins>Komputerowe</a><ul><li id="/Initiative/Browse?category=9" class="jstree-last jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Strategie</a><ul><li id="/Initiative/Browse?category=10" class="jstree-last jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Age of Empires</a></li></ul></li></ul></li><li id="/Initiative/Browse?category=6" class="jstree-last jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a class=""><ins class="jstree-icon">&nbsp;</ins>Planszowe</a><ul><li id="/Initiative/Browse?category=7" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Magia i Miecz</a></li><li id="/Initiative/Browse?category=13" class="jstree-last jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Eurobusiness</a></li></ul></li></ul></li><li id="/Initiative/Browse?category=2" class="jstree-last jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a class=""><ins class="jstree-icon">&nbsp;</ins>Sport</a><ul><li id="/Initiative/Browse?category=3" class="jstree-last jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Zespołowe</a><ul><li id="/Initiative/Browse?category=4" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Piłka nożna</a></li><li id="/Initiative/Browse?category=5" class="jstree-last jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a><ins class="jstree-icon">&nbsp;</ins>Rugby</a></li></ul></li></ul></li></ul>
                 -->


         <div id="catTree" class="catTree" >
                   
               @Html.CategoryTreeView(Request)
                            
               
        </div>
         @*<ul>
            <li id="1">
                <a href="/Initiative/Browse?category=1">aaaa</a>
                <ul>
                    <li id="2">
                        <a href="/Initiative/Browse?category=2">bbbb</a>
						<ul>
							<li id="3">
								<a href="/Initiative/Browse?category=3">cccc</a>
							</li>
							<li id="4">
								<a href="/Initiative/Browse?category=4">dddd</a>
							</li>
						</ul>
                    </li>
                    <li id="5">
                        <a href="/Initiative/Browse?category=5">eeee</a>
                    </li>
                </ul>
            </li>
            <li id="6">
                <a href="/Initiative/Browse?category=6">ffff</a>
                <ul>
                    <li id="7">
                        <a href="/Initiative/Browse?category=7">gggg</a>
                    </li>
                    <li id="8">
                        <a href="/Initiative/Browse?category=8">hhhh</a>
                    </li>
                </ul>
            </li>
        </ul>*@

                        <!--end drzewo boczne kategorii inicjatyw -->


<script type="text/javascript" class="source">
    /*
    pamiętać: id="nazwa" nie powinna zawierać takich znaków: = . / itd itp
    
    
    */
                             /*
                             $(function () {
                             $("#demo1").jstree({
                             "plugins": ["themes", "html_data", "ui", "cookies"]
                             });
                             });
                             */
                             /*
var name = "ccc/cc?=";
$(document).ready(function () {

    $("#categoryThree1").jstree(
		{
		    "themes": {
		        "theme": "initiative",
		        "dots": false,
		        "icons": false
		    },
		    "core": { "initially_open": [name] },

		    "plugins": ["themes", "html_data", "cookies"]
		})
		.bind("select_node.jstree", function (event, data) {//TODO! zmieniono z select_node.jstree
		    var href = data.rslt.obj.children("a").attr("href");
		    //window.location.href = data.rslt.obj.attr("id");
		    window.location.href = href;

		    //$("#contents").load(href);
		})


		.delegate("a", "click", function (event, data) { event.preventDefault(); })

});
*/


//WERSJA Z 20.06
/*
    var testname = $.cookie("testcookie");
    //alert(testname);
    $(document).ready(function () {
        var tree = $("#categoryThree1");
        $("#categoryThree1")
		.jstree({
		    "themes": {
		        "theme": "initiative",
		        "dots": false,
		        "icons": false
		    },
		    "core": {
		        "initially_open": [testname]
		    }, //open current node
		    "plugins": [
                "themes",
                "html_data",
                "ui"
            ]
		})
		.bind("select_node.jstree", function (event, data) {
		    window.location.href = data.rslt.obj.children("a").attr("href")
		    //alert(data.rslt.obj.children("a").attr("href")); 	    // `data.rslt.obj` is the jquery extended node that was clicked
		    $.cookie('testcookie', data.rslt.obj.attr("id"));
		    //alert($.cookie('testcookie'));
		});
        //ustawia hover na itemie przy załadowaniu
        setTimeout(function () {
            $("#categoryThree1").jstree("set_focus");    
        }, 500);
        setTimeout(function () {
            $.jstree._focused().hover_node("#"+testname);
        }, 500);
    });
    */
</script>
                    </div>
                    <div id="filterMenu">
                    
                    </div>
                </div>
            </div>
            <!-- MAIN CONTENT -->
            <div class="span9">
                <!-- breadcrumbs scieżki kategorii -->
               
                @if (Request.QueryString["category"] != null && (Request.Url.LocalPath.StartsWith("/Initiative/Browse") || (Request.Url.LocalPath.StartsWith("/Initiative/Details"))))
                {
                    int tmp;
                    if (int.TryParse(Request.QueryString["category"], out tmp) && tmp != 0)
                    { 
                            <div class="row-fluid">
                            <div class="span12">
                            
                                @Html.CategorySiteMap(tmp)
                             
                            </div>
                            </div>
                    }
                }
                //wyświetlanie ścieżki kategorii w Initiative/Details
                else if (Request.Url.LocalPath.StartsWith("/Initiative/Details"))
                {
                    int tmp = 13;

                            <div class="row-fluid">
                            <div class="span12">
                            
                                @Html.CategorySiteMap(tmp)
                                
                            </div>
                            </div>
                    

                }

                <!--end breadcrumbs  -->
                <div class="well">
                    @RenderBody()
                </div>
            </div>
            <!-- END MAIN CONTENT-->
        </div>
        <!-- stopka -->
        <div class="row-fluid ini-footer">
            <div class="span12" ">
                Portal ivent.pl 2012</div>
        </div>
        <!-- stopka -->
        <!-- odstęp -->
        <div class="row-fluid">
            <div class="span12">
            </div>
        </div>
        <!-- end odstęp -->
    </div>
    <!-- dolny navbar -->
    <div class="navbar navbar-fixed-bottom ini-bottom-navbar" >
        <div class="navbar-inner ini-bottom-navbar-inner" >
            <div class="container">
                <div class="row">
                    <div class="span12 ini-user-info"> @Html.Partial("_LogOnPartial2") 
                    </div>

                </div>
             </div>
        </div>
    </div>
    <!-- end dolny navbar -->
</body>
</html>
